import java.sql.SQLException;
import java.util.List;
import java.util.ArrayList;
import java.sql.ResultSet; 


public class Test {
	public static void main(String[] args) throws SQLException {
    	HsqldbConn con;
		con = new HsqldbConn();
		con.openConn("YK"); 
		
		List<Player> listIt = new ArrayList<Player>(); //build a empty List
		Player temp;  // for temporary data transfer
    	ResultSet rs = con.select("Player"); //try select/get and save the data to a ResultSet
	    while ( rs.next() )
	    {     
	    	  temp = new Player();    // initialize
	    	  String name = rs.getString(2); // from database to local
	    	  String tname = rs.getString(3);  
              String birth = rs.getString(4);
              temp.setPlayer(name,tname,birth); // generate an Item 
              listIt.add(temp); // add this Item to the List
	    } 
	    rs.close(); 
	    
	    for(int j=0;j<listIt.size();j++){
	    	listIt.get(j).print();
	    }
	    
	    con.closeConn();
		System.out.println("Done! Connection Closed");

	}
	

}
